var utils = require('./utils/util.js')
var c = require('./utils/config.js')
App({
  onLaunch: function (e) {
    // 展示本地存储能力
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs);
    wx.login({
         //获取code 后端获取openid
        success: (res) => {
          var data = {
            url:'/comv1/com/getwxopenid',
            code: res.code
          };
          utils.request(data).then(function (res) {
            if(res.code!=0){
              wx.showToast({
                  title: res.msg,
                  icon: 'none',
                  duration: 1500
              })
              return false;
            }
            var openId = res.data.openid;
            utils.userthree(openId);
            wx.setStorageSync('openId', openId);
          });
      }
    });
    wx.setStorageSync("scene", e.scene);//场景值存储
  },
  globalData: {

  }
})
